﻿<%--<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<CRM.Models.TrainingsRequestsExt>" %>--%>
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<CRM.Database.Model.TrainingsRequestsExt>" %>
<%@ Import Namespace="CRM.Models" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Новая заявка на выездной курс
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<h2>Новая заявка на выездной курс</h2>

<% using (Html.BeginForm("TrainingsRemoteRequestCreate"))
       { %>
    <%: Html.ValidationSummary(true) %>
    <%:Html.Hidden("Request.IdTrainingsRequest")%>
    <%:Html.Hidden("Request.IdTrainingsSchedule")%>
    <%:Html.Hidden("Request.IdCustomer")%>
    <%:Html.Hidden("Request.IdTrainingsCourse")%>
    <%:Html.Hidden("Key")%>
      

    <br />
    <%:Html.DevExpress().Label(
              settings =>
                  {
                      settings.ControlStyle.CssClass = "lable";
                      settings.Text = "Участники";
                      settings.Width = 500;
                  }).GetHtml() %>
    <% Html.RenderPartial("TrainingsParticipantsPartial"); %>



    <table>
        <tr>
            <td>
                <%:Html.DevExpress().Label(
                  settings =>
                  {
                      settings.ControlStyle.CssClass = "lable";
                      settings.Text = "Целевая аудитория:";
                      settings.Width = 247;
                  }).GetHtml() %>
            </td>
            <td>
                <%:Html.DevExpress().Label(
                  settings =>
                  {
                      settings.ControlStyle.CssClass = "lable";
                      settings.Text = "Кол-во участников:";
                      settings.Width = 247;
                  }).GetHtml() %>
                
            </td>
        </tr>
        <tr>
            <td>
                <%
                    var auditoriumsCol = new CRM.Database.Model.TrainingsAuditoriumsCollection();
                    Html.DevExpress().ComboBox(settings =>
                                                   {
                                                       settings.Name = "IdTrainingsAuditorium";
                                                       settings.CallbackRouteValues = new { Controller = "TC", Action = "TrainingsRequestLEPartial", key = Model.Key };
                                                       settings.Properties.ValueType = typeof(int);
                                                       settings.Properties.TextField = "LocalizedName";
                                                       settings.Width = 247;
                                                       settings.Properties.ValueField = "IdTrainingsAuditorium";
                                                   }).BindList(auditoriumsCol.GetAuditoriumsListByCourseId(Model.Request.IdTrainingsCourse)).Bind(Model.IdTrainingsAuditorium).GetHtml();
                %>
            </td>
            <td>
                <%:Html.DevExpress().SpinEdit(
                    settings =>
                    {
                        settings.Name = "Request.PredictParticipantsCount";
                        settings.ControlStyle.CssClass = "editor";
                        //settings.Properties.DisplayFormatString = "N1";
                        //settings.Properties.Increment = (decimal)0.5;
                        settings.Width = 247;
                    }).GetHtml()%>
            </td>
        </tr>
    </table>

    <br />
    <%:Html.DevExpress().Label(
              settings =>
                  {
                      settings.ControlStyle.CssClass = "lable";
                      settings.Text = "Возможные сроки проведения:";
                      settings.Width = 500;
                  }).GetHtml() %>

    <table>
        <tr>
            <td>
            <%:Html.DevExpress().Label(
              settings =>
                  {
                      settings.ControlStyle.CssClass = "lable";
                      settings.Text = "C:";
                      settings.Width = 120;
                  }).GetHtml() %>
            </td>
            <td>
            <%:Html.DevExpress().DateEdit(settings =>
                {
                    settings.Name = "Request.FirstDate";
                    settings.Properties.DisplayFormatString = "D";
                    settings.Width = 120;
                }).Bind(Model.Request.FirstDate).GetHtml() %>
            </td>
            <td>
            <%:Html.DevExpress().Label(
              settings =>
                  {
                      settings.ControlStyle.CssClass = "lable";
                      settings.Text = "По:";
                      settings.Width = 120;
                  }).GetHtml() %>
            </td>
            <td>
            <%:Html.DevExpress().DateEdit(settings =>
                {
                    settings.Name = "Request.LastDate";
                    settings.Properties.DisplayFormatString = "D";
                    settings.Width = 120;
                }).Bind(Model.Request.LastDate).GetHtml() %>
            </td>
        </tr>
        
    </table>
    
    <table>
        <tr>
            <td>
                <%:Html.DevExpress().Label(settings =>
                  {
                      settings.ControlStyle.CssClass = "lable";
                      settings.Text = "Название юр. лица";
                      settings.Width = 232;
                  }).GetHtml() %>
                <%: Html.Partial("TrainingsRequestLEPartial", Model)%>
                
                <%--<%:Html.DevExpress().Label(settings =>
                  {
                      settings.ControlStyle.CssClass = "lable";
                      settings.Text = "Название юр. лица";
                      settings.Width = 232;
                  }).GetHtml() %>

                <% 
                    if (Model.Request.IdLegalEntity > 0)
                    {
                        Html.DevExpress().ComboBox(settings =>
                        {
                            settings.Name = "Request.IdLegalEntity";
                            settings.ControlStyle.CssClass = "editor";
                            settings.Properties.TextField = "Name";
                            settings.Properties.ValueField = "IdLegalEntity";
                            settings.Properties.ValueType = typeof (int);
                            settings.Width = 232;
                        }).BindList(DB.GetCustomerById((int)Model.Request.IdCustomer).LegalEntities).Bind(Model.Request.IdLegalEntity).GetHtml();
                    }else
                    {
                        Html.DevExpress().TextBox(settings =>
                        {
                            settings.Name = "Request.Company";
                            settings.Width = 232;
                            settings.Properties.NullText = "Введите название юр. лица...";
                        }).GetHtml();
                    }
                %>--%>
            </td>
            <td>
                

                <%--<%:Html.DevExpress().Label(settings =>
                  {
                      settings.ControlStyle.CssClass = "lable";
                      settings.Text = "Контактное лицо";
                      settings.Width = 232;
                  }).GetHtml() %>
    
                <% 
                    if (Model.Request.IdContact > 0)
                    {
                        Html.DevExpress().ComboBox(settings =>
                        {
                            settings.Name = "Request.IdContact";
                            settings.ControlStyle.CssClass = "editor";
                            settings.Properties.TextField = "Name";
                            settings.Properties.ValueField = "IdContact";
                            settings.Properties.ValueType = typeof (int);
                            settings.Width = 232;
                        }).BindList(DB.GetCustomerById((int)Model.Request.IdCustomer).Contacts).Bind(Model.Request.IdContact).GetHtml();
                    }else
                    {
                        Html.DevExpress().TextBox(settings =>
                        {
                            settings.Name = "Request.ContactName";
                            settings.Width = 232;
                            settings.Properties.NullText = "Введите имя контактного лица...";
                        }).GetHtml();
                    }
                %>--%>
            </td>
        </tr>
        <tr>
            <td>
                <%:Html.DevExpress().Label(settings =>
                  {
                      settings.ControlStyle.CssClass = "lable";
                      settings.Text = "Контакты";
                      settings.Width = 232;
                  }).GetHtml() %>
                <%: Html.Partial("TrainingsRequestContactPartial", Model)%>
                <%--<%:Html.DevExpress().Label(settings =>
                    {
                        settings.ControlStyle.CssClass = "lable";
                        settings.Text = "Контактный телефон";
                        settings.Width = 232;
                    }).GetHtml() %>
                <%:Html.DevExpress().TextBox( settings => 
                    {
                        settings.Name = "Request.ContactPhone";
                        settings.Width = 232;
                        settings.Properties.MaskSettings.Mask = "+7 (999) 000-00-00";
                        settings.Properties.MaskSettings.IncludeLiterals = MaskIncludeLiteralsMode.None;
                    }).GetHtml()%>--%>
            </td>
            <td>
                <%--<%:Html.DevExpress().Label(settings =>
                    {
                        settings.ControlStyle.CssClass = "lable";
                        settings.Text = "Адрес электронной почты";
                        settings.Width = 232;
                    }).GetHtml() %>
                <%:Html.DevExpress().TextBox( settings => 
                    {
                        settings.Name = "Request.ContactEmail";
                        settings.Width = 232;
                        settings.Properties.NullText = "Введите адрес почты";
                    }).GetHtml()%>--%>
            </td>
        </tr>
    </table>
    <br/>
    <table>
        <tr>
            <td>
                <%:Html.DevExpress().Label(settings =>
                              {
                                  settings.ControlStyle.CssClass = "lable";
                                  settings.Text = "Расходы на организацию";
                                  settings.Width = 247;
                              }).GetHtml() 
                %>
            </td>
            <td>
                <%:
                    Html.DevExpress().ComboBox( settings => 
                            {
                                settings.Name = "comboBox1";
                                settings.Width = 247;
                                settings.SelectedIndex = 0;
                                settings.Properties.ValueType = typeof(string);
                                settings.Properties.Items.Add("Клиент");
                            }).GetHtml()
                 %>
            </td>
        </tr>
    </table>

    

    

    <%--<br />
    <%:Html.DevExpress().Label(
              settings =>
                  {
                      settings.ControlStyle.CssClass = "lable";
                      settings.Text = "Название компании";
                      settings.Width = 500;
                  }).GetHtml() %>
    <%:Html.DevExpress().TextBox( settings => 
                    {
                        settings.Name = "Request.Company";
                        settings.Width = 500;
                        settings.Properties.NullText = "Введите название компании...";
                        settings.ReadOnly = true;
                        //settings.Enabled = false;
                    }).Bind(Model.Request.Company).GetHtml()%>

    <br />
    <%:Html.DevExpress().Label(
              settings =>
                  {
                      settings.ControlStyle.CssClass = "lable";
                      settings.Text = "Контактное лицо";
                      settings.Width = 500;
                  }).GetHtml() %>
    <%:Html.DevExpress().TextBox( settings => 
                    {
                        settings.Name = "Request.ContactName";
                        settings.Width = 500;
                        settings.Properties.NullText = "Введите имя контактного лица...";
                    }).GetHtml()%>
    
    <br />
    <%:Html.DevExpress().Label(
              settings =>
                  {
                      settings.ControlStyle.CssClass = "lable";
                      settings.Text = "Контактный телефон";
                      settings.Width = 500;
                  }).GetHtml() %>
    <%:Html.DevExpress().TextBox( settings => 
                    {
                        settings.Name = "Request.ContactPhone";
                        settings.Width = 500;
                        settings.Properties.MaskSettings.Mask = "+7 (999) 000-00-00";
                        settings.Properties.MaskSettings.IncludeLiterals = MaskIncludeLiteralsMode.None;
                    }).GetHtml()%>

    <br />
    <%:Html.DevExpress().Label(
              settings =>
                  {
                      settings.ControlStyle.CssClass = "lable";
                      settings.Text = "Адрес электронной почты";
                      settings.Width = 500;
                  }).GetHtml() %>
    <%:Html.DevExpress().TextBox( settings => 
                    {
                        settings.Name = "Request.ContactEmail";
                        settings.Width = 500;
                        settings.Properties.NullText = "Введите адрес электронной почты";
                    }).GetHtml()%>
--%>


    <br />
    <%:Html.DevExpress().Label(
              settings =>
                  {
                      settings.ControlStyle.CssClass = "lable";
                      settings.Text = "Город проведения";
                      settings.Width = 500;
                  }).GetHtml() %>
    <%:Html.DevExpress().TextBox( settings => 
                    {
                        settings.Name = "Request.Company";
                        settings.Width = 500;
                        settings.Properties.NullText = "Введите город проведения";
                    }).GetHtml()%>

    <br />
    <%:Html.DevExpress().Label(
              settings =>
                  {
                      settings.ControlStyle.CssClass = "lable";
                      settings.Text = "Причина";
                      settings.Width = 500;
                  }).GetHtml() %>
    <%:Html.DevExpress().TextBox( settings => 
                    {
                        settings.Name = "Request.Reason";
                        settings.Width = 500;
                        settings.Properties.NullText = "Введите причину подачи заявки";
                    }).GetHtml()%>

    <br />
    <%:Html.DevExpress().Label(
              settings =>
                  {
                      settings.ControlStyle.CssClass = "lable";
                      settings.Text = "Комментарий";
                      settings.Width = 500;
                  }).GetHtml() %>
    <%:Html.DevExpress().TextBox( settings => 
                    {
                        settings.Name = "Request.Comments";
                        settings.Width = 500;
                        settings.Properties.NullText = "Комментарии...";
                    }).GetHtml()%>



    <button type="submit" value="Создать заявку">Создать заявку</button>
    <% } %>
</asp:Content>
